package com.example.hzzrpcclient.service.impl;

import com.example.hzzrpcclient.config.annotations.RpcAutowired;
import com.example.hzzrpcinterface.MyServiceServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author ：hzz
 * @description：TODO
 * @date ：2022/1/2 21:32
 */
@Service
public class RpcClientServiceimpl {

    @RpcAutowired
    private MyServiceServer myServiceServer;


    @Autowired
    private Hello2Serviceimpl hello2Serviceimpl;





    public String hello(){
          long s = System.currentTimeMillis();   //获取开始时间

        String hello = myServiceServer.hello();
        long e = System.currentTimeMillis(); //获取结束时间

        System.out.println(hello+"通过rpc远程调用获取到的值"+"用时：" + (e - s) + "ms");
        return hello+hello2Serviceimpl.hello2();
    }
}
